package com.fulin.thread.interupte;
/**
*
* @description 
* @auther fulin16@crnet.com.hk
* @since 2019年3月1日 下午5:46:34
*
*/
public class Main {
	public static void main(String[] args) {
		Thread t1 = new Thread(new Runnable(){

			@Override
			public void run() {
				while(true){
					System.out.println("Thread1 interrupt value : "+ Thread.currentThread().isInterrupted());
					if(Thread.currentThread().isInterrupted()){
						System.out.println("Thread1 被中断了...");
						Thread.currentThread().interrupted();
						System.out.println("Thread1 被复位了....");
					}
				}
			}
			
		},"Thread1");
		
		t1.start();
		
		new Thread(new Runnable(){

			@Override
			public void run() {
				while(true){
					try {
						Thread.currentThread().sleep(5000L);
						t1.interrupt();
						System.out.println("已经打过招呼了");
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
			
		},"Thread2").start();
	}
}
